package cm.tang.config;

import cm.tang.message.RedisMqClientProxy;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.listener.RedisMessageListenerContainer;

import javax.annotation.Resource;

/**
 * @author Tang
 * @classname RootConfig
 * @description [  ]
 * @date 2021/6/2 11:44
 */
@Configuration
public class RootConfig {

    @Resource
    RedisTemplate<String, Object> redisTemplate;

    @Bean
    public RedisMessageListenerContainer mailMqClientProxy() {
        return new RedisMqClientProxy(redisTemplate).subscribe("mail", ((message, topic) -> {
            System.out.println("receive...." + message);
        }));
    }

}